/********************************************************************************
 * Copyright (c)2016-2020, ShenZhen WanJiaAn Technology CO.,LTD.
 * All Rights Reserved.
 *
 * File Name     : MediaPack.h
 * Author        : joki.zhu
 * Date          : 2019-10-08
 *
 * Record        :
 * 1.Date        : 2019-10-08
 *   Author      : joki.zhu
 *   Modification: Created file
 ********************************************************************************/

#ifndef __MEDIAPACK_H__
#define __MEDIAPACK_H__

#include "av_type.h"
#include <semaphore.h>

#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */

typedef enum {
	MEDIA_VENC_RC_MODE_CBR = 0,
	MEDIA_VENC_RC_MODE_VBR,
	MEDIA_VENC_RC_MODE_SMART,
	MEDIA_VENC_RC_MODE_LAST,
}MEDIA_VENC_RC_MODE_E;

typedef enum {
	MEDIA_ENC_TYPE_H264 = 0,
	MEDIA_ENC_TYPE_H265,
	MEDIA_ENC_TYPE_MJPEG,
	MEDIA_ENC_TYPE_JPEG,
	MEDIA_ENC_TYPE_PCM,
	MEDIA_ENC_TYPE_G711A,
	MEDIA_ENC_TYPE_G711U,
	MEDIA_ENC_TYPE_G726,
	MEDIA_ENC_TYPE_AAC,
	MEDIA_ENC_TYPE_LAST
}MEDIA_ENC_TYPE_E;

typedef enum {
	MEDIA_VIDEO_FRAME_TYPE_P = 0,
	MEDIA_VIDEO_FRAME_TYPE_I,
	MEDIA_VIDEO_FRAME_TYPE_B,
	MEDIA_VIDEO_FRAME_TYPE_LAST	
}MEDIA_VIDEO_FRAME_TYPE_E;

typedef struct {
	AV_U32      phyAddr;						/**< 码流包物理地址 */
	AV_U8       *pVirAddr;						/**< 码流包虚拟地址 */
	AV_U32	    length;						/**< 码流包长度 */
	AV_U64	    timestamp;						/**< 时间戳，单位us */
	AV_BOOL     frameEnd;						/**< 帧结束标识 */
}MEDIA_STREAM_PACK;

typedef struct {
	MEDIA_STREAM_PACK  *pstPack;		        /**< 帧码流包结构 */
	AV_U32              packCount;			    /**< 一帧码流的所有包的个数 */
	AV_U32              seq;				    /**< 编码帧码流序列号 */
}MEDIA_STREAM_VIDEO;

typedef struct {
	MEDIA_ENC_TYPE_E         enEncType;
	MEDIA_VIDEO_FRAME_TYPE_E enFrameType;
}MEDIA_DATA_TYPE_S;

typedef struct {
	MEDIA_DATA_TYPE_S   stDataType;
	AV_U64              timestamp;
	AV_U32              frameSize;
	AV_VOID             *pFrameData;
	AV_U32              seq;
 	sem_t               writeSem;
	sem_t               readSem;
}MEDIA_PACK_VIDEO;

typedef struct {
	MEDIA_DATA_TYPE_S   stDataType;
	AV_U64              timestamp;
	AV_U32              frameSize;
	AV_VOID             *pFrameData;
	AV_U32              seq;
 	sem_t               writeSem;
	sem_t               readSem;
}MEDIA_PACK_AUDIO;

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */


#endif /* __MEDIAPACK_H__ */
